package prime.applogic;



import prime.applogic.ApplicationManager;
import prime.applogic.MetodHelper;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import prime.util.PropertyLoader;
import prime.util.Browser;
import prime.webdriver.WebDriverFactory;


public class ApplicationManager {
	
	private MetodHelper metodHelper;
	private WebDriver driver;
	private String baseUrl;
	
	public ApplicationManager() {
		baseUrl = PropertyLoader.loadProperty("site.url");
		String gridHubUrl = PropertyLoader.loadProperty("grid2.hub");
		
		Browser browser = new Browser();
		browser.setName(PropertyLoader.loadProperty("browser.name"));
		browser.setVersion(PropertyLoader.loadProperty("browser.version"));
		browser.setPlatform(PropertyLoader.loadProperty("browser.platform"));
		
		String username = PropertyLoader.loadProperty("user.username");
		String password = PropertyLoader.loadProperty("user.password");
		//FirefoxProfile profile = new ProfilesIni().getProfile("default"); 
		 //driver = new FirefoxDriver(profile);
		driver = WebDriverFactory.getInstance(gridHubUrl, browser, username, password);
		driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
		
		metodHelper = new MetodHelper(this);
		
		
		//getNavigationHelper().openMainPage();
	}
	
	public MetodHelper getMetodHelper() {
		return metodHelper;
	}
	
	public WebDriver getWebDriver() {
		return driver;
	}

	public String getBaseUrl() {
		return baseUrl;
	}


}
